Skip to main content

Last Update: 2025/3/26

Kling Text to Video API

The Text to Video API enables you to create video content from text descriptions using Kling's AI models. This document provides details about the API endpoint, parameters, and response structure.

Endpoint

POST https://platform.llmprovider.ai/v1/videos/text2video

Request Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Body

The request body should be a JSON object with the following parameters:

FieldTypeDescription
modelstringThe model to use. Options: kling-video-v1, kling-video-v1-6
promptstringText prompt for video generation (max 2500 characters).
negative_promptstring(Optional) Negative text prompt (max 2500 characters).
cfg_scalefloat(Optional) Generation freedom scale [0, 1]. Higher values mean stricter adherence to prompt. Default: 0.5
modestring(Optional) Generation mode. Options: std (standard), pro (professional quality). Default: std
camera_controlobject(Optional) Camera movement controls. Optional
aspect_ratiostring(Optional) Video aspect ratio. Options: 16:9, 9:16, 1:1. Default: 16:9
durationstring(Optional) Video duration in seconds. Options: 5, 10. Default: 5
external_task_idstring(Optional) Custom task identifier. Optional

Camera Control Object

FieldTypeDescription
typestringCamera movement type: simple, down_back, forward_up, right_turn_forward, left_turn_forward
configobjectCamera configuration (required when type is simple)

Camera Config Object

All fields are optional with range [-10, 10]:

  • horizontal: Horizontal movement
  • vertical: Vertical movement
  • pan: Horizontal rotation (Y-axis)
  • tilt: Vertical rotation (X-axis)
  • roll: Roll rotation (Z-axis)
  • zoom: Zoom level change

Example Request

{
"model": "kling-video-v1",
"prompt": "A beautiful sunset over the ocean",
"camera_control": {
"type": "simple",
"config": {
"pan": 1
}
}
}

Response Body

The API returns a JSON object with the following structure:

FieldTypeDescription
task_idstringGenerated task identifier
task_infoobjectTask creation parameters
task_statusstringTask status: submitted, processing, succeed, failed
created_atintegerTask creation timestamp (milliseconds)
updated_atintegerLast update timestamp (milliseconds)

Example Response

{
"task_id": "task_xyz789",
"task_info": {
"external_task_id": "custom_id_123"
},
"task_status": "submitted",
"created_at": 1722769557708,
"updated_at": 1722769557708
}

Example Request

curl -X POST https://platform.llmprovider.ai/v1/videos/text2video \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-video-v1",
"prompt": "A beautiful sunset over the ocean",
"camera_control":{
"type": "simple",
"config":{
"pan": 1
}
}
}'

For any questions or further assistance, please contact us at [email protected].